import request from "@/utils/request";

// 删除单个文件
export function removeFile(type, secondFilePath, fileName) {
  const _secondFilePath = secondFilePath ? secondFilePath : "";
  return request({
    url: `/api/file/remove/${type}/${_secondFilePath}${fileName}`,
    method: "get",
  });
}
// 获取下载文件链接
export function getDownloadUrl(type, secondFilePath, fileName) {
  const _secondFilePath = secondFilePath ? secondFilePath : "";
  return request({
    url: `/api/file/Download/${type}/${_secondFilePath}${fileName}`,
    method: "get",
  });
}
// 上传文件
export function uploaderFile(data, modular, type) {
  return request({
    url: `/api/file/Uploader/${modular}/${type}`,
    method: 'post',
    data
  })
}
// 预览文件
export function PreviewFile(data) {
  return request({
    url: `/api/file/Uploader/Preview`,
    method: "get",
    data,
  });
}
export function getPreviewFileTaskUrl() {
  return request({
    url: `/api/file/Uploader/getPreviewFileTaskUrl`,
    method: "get",
  });
}
// 获取列设置
export const getColumnsByModuleId = (moduleId) => {
  return request({
    url: `/api/permission/Authority/GetColumnsByModuleId/${moduleId}`,
    method: "GET",
  });
};
// 设置列设置
export const setColumnsByModuleId = (data) => {
  return request({
    url: `/api/permission/Authority/SetColumnsByModuleId`,
    method: "PUT",
    data,
  });
};
// 分片组装
export const chunkMerge = (data) => {
  return request({
    url: `/api/file/merge`,
    method: "POST",
    data,
  });
};

// // 预览文件
// export function PreviewFileNew(data) {
//   return request({
//     url: `/api/file/Uploader/Preview`,
//     method: 'get',
// 	  data
//   })
// }
